#ifndef __TCP_H__
#define __TCP_H__
#include <netinet/in.h>

#define SERVER_PORT 8888
#define SERVER_IP "8.138.248.21"

typedef struct
{
    int sockfd;              // 通信的套接字
    struct sockaddr_in addr; // 服务器地址
} server_info_t;

extern server_info_t server_info;

void * get_message(void * arg);
int send_message_to_server(server_info_t * info, char * msg);
void * send_message(void * arg);
int init_tcp_client(server_info_t * info);

void parse_server_response(const char * response); // 解析服务器返回的消息
#endif